Repository navigation
fix(aggregator): validate quota-current windows - #4182
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 531992d517
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const windows = arrayOf(isQuotaCurrentWindow)(provider.windows)!; | ||
| droppedWindows += windows.dropped; | ||
| return { ...provider, windows: windows.values }; |
There was a problem hiding this comment.
Downgrade providers whose windows are entirely discarded
When a fresh ok provider has only malformed windows, sanitization leaves it as an ok entry with an empty window list. overlayQuotaCurrent still selects it as the newest fresh entry, and applyEntry stamps the pool's existing dated windows with fresh ok provenance without replacing them. It also prevents an older valid fresh credential for the same service from supplying the headline windows. For example, a newest entry with windows: [null] and a valid sibling reporting 80% leaves the base pool's 11% displayed as freshly measured. Distinguish an entry emptied by validation from a legitimate balance-only read, and drop or downgrade the malformed entry so it cannot claim freshness or suppress a valid overlay.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6aee703. parseQuotaCurrent now downgrades an "ok" entry whose windows were entirely dropped by sanitization to state "error" (error: "all quota windows were malformed and dropped at ingest"), so it can no longer win fresh-ok precedence, stamp the pool's dated windows with fresh provenance, or block a valid fresh sibling. Entries that arrived windowless (balance-only reads) keep their state. Regression tests added in quota-current.test.ts: the sibling case (valid 80% read supplies the headline, freshness measuredAt from the sibling) and the sole-entry case (pool surfaces error, base windows keep their dated 11%).
…dropped (#2416) Codex P2 on PR #4182 (4439072783): parseQuotaCurrent kept an ok entry whose windows were all discarded by sanitization. overlayQuotaCurrent then selected it as the newest fresh entry and applyEntry stamped the pools older windows with fresh ok provenance, while a valid older fresh sibling for the same service was blocked from supplying the headline. Downgrade such an entry to error at the ingest boundary; an entry that arrived windowless (balance-only) keeps its state. Tests: sibling case (valid 80% read supplies the headline, freshness from the sibling) and sole-entry case (surfaces error, base windows keep their dated values).
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #2416
Summary
Evidence
windows: [null]passed parsing and threw during overlay; malformedname/resetsAtvalues also reached quota windows (reproduced in the issue triage).bun test test/quota-current.test.ts— 31 pass, 0 fail; regression keeps valid overlays for multiple providers while dropping malformed entries.bun run typecheckcould not run to completion: TypeScript reports missing type definitions forbun(TS2688).Merge Danger
Door: Two-way — the parser change can be reverted.
Blast Radius: Low — quota-current ingest and its live provenance only.
Need help on this PR? Tag
@codesmith-botwith what you need.